package com.suixinsanren.design.observer.demo01;

public class ThirdPartyDisplay implements Observer, Display {

    private Double temperature;

    @Override
    public void display() {
        if (temperature > 30) {
            System.out.println("最高温度" + temperature + "热死人");
        } else {
            System.out.println("最低温度" + temperature + "冷死人");
        }
    }

    @Override
    public void update(Double temperature, Double humidity, Double pressure) {
        this.temperature = temperature;
        display();
    }
}
